package cn.tedu;

import com.mysql.cj.jdbc.CallableStatement;

import java.sql.*;

public class Demo03 {
    public static void main(String[] args) throws SQLException {
        Connection conn =
                DriverManager.getConnection("jdbc:mysql://localhost:3306/empdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai",
                        "root","root");
        Statement s=conn.createStatement();
        //此方法用来执行增删改相关的SQL语句,  返回值表示生效的行数
        // s.executeUpdate("insert into emp(name) values ('tom')");
        // s.executeUpdate("update emp set name='pig' where name='tom'");
        // s.executeUpdate("delete from emp where name='pig'");
        ResultSet rs=s.executeQuery("select * from emp");
        while (rs.next()){
            //里面写数字代表对应的读取位置
            Object o=rs.getObject(3);
            System.out.println(o);
        }
        conn.close();

    }
}
